/*****************************************************************************
*        描述 :
*             文件描述
*        CLR版本:            3.5
*        创建者 :            蒋 光
*        个人域名:           jiangguang.net.cn
*        命名空间名称:       ECP.Model
*        文件名:             BaseUserEntity.cs
*        创建系统时间:       2012/11/2 19:07:04
*        创建年份:           2012
*
/*****************************************************************************/

namespace ECP.Model
{
    using System;
    using System.Data;
    using ECP.Utilities;

    [Serializable]
    public class BaseUserEntity
    {
        private string answerQuestion;
        private string auditStatus;
        private string birthday;
        private string code;
        private string company;
        private string createDate;
        private string createUserID;
        private bool deleteMark;
        private string department;
        private string description;
        private string duty;
        private string email;
        private bool enabled;
        private string firstVisit;
        private string homeAddress;
        private string id;
        private string ipAddress;
        private bool isStaff;
        private bool isVisible;
        private string lang;
        private string lastVisit;
        private string loginCount;
        private string macAddress;
        private string mobile;
        private string modifyDate;
        private string modifyUserID;
        private string oicq;
        private string previousVisit;
        private string question;
        private string realname;
        private string role;
        private string roleFullName;
        private string sex;
        private string sortCode;
        private string suid;
        private string theme;
        private string title;
        private string userName;
        private int userOnLine;
        private string userPassword;
        private string workgroup;

        public BaseUserEntity()
        {
            this.id = string.Empty;
            this.userName = string.Empty;
            this.code = string.Empty;
            this.realname = string.Empty;
            this.role = "User";
            this.roleFullName = string.Empty;
            this.sex = string.Empty;
            this.birthday = string.Empty;
            this.mobile = string.Empty;
            this.oicq = string.Empty;
            this.email = string.Empty;
            this.homeAddress = string.Empty;
            this.userPassword = string.Empty;
            this.company = string.Empty;
            this.department = string.Empty;
            this.workgroup = string.Empty;
            this.duty = string.Empty;
            this.title = string.Empty;
            this.isStaff = true;
            this.firstVisit = string.Empty;
            this.previousVisit = string.Empty;
            this.lastVisit = string.Empty;
            this.loginCount = string.Empty;
            this.lang = string.Empty;
            this.theme = string.Empty;
            this.isVisible = true;
            this.suid = string.Empty;
            this.ipAddress = string.Empty;
            this.macAddress = string.Empty;
            this.question = string.Empty;
            this.answerQuestion = string.Empty;
            this.auditStatus = string.Empty;
            this.description = string.Empty;
            this.sortCode = string.Empty;
            this.createUserID = string.Empty;
            this.createDate = string.Empty;
            this.modifyUserID = string.Empty;
            this.modifyDate = string.Empty;
        }

        public BaseUserEntity(DataRow DataRow)
        {
            this.id = string.Empty;
            this.userName = string.Empty;
            this.code = string.Empty;
            this.realname = string.Empty;
            this.role = "User";
            this.roleFullName = string.Empty;
            this.sex = string.Empty;
            this.birthday = string.Empty;
            this.mobile = string.Empty;
            this.oicq = string.Empty;
            this.email = string.Empty;
            this.homeAddress = string.Empty;
            this.userPassword = string.Empty;
            this.company = string.Empty;
            this.department = string.Empty;
            this.workgroup = string.Empty;
            this.duty = string.Empty;
            this.title = string.Empty;
            this.isStaff = true;
            this.firstVisit = string.Empty;
            this.previousVisit = string.Empty;
            this.lastVisit = string.Empty;
            this.loginCount = string.Empty;
            this.lang = string.Empty;
            this.theme = string.Empty;
            this.isVisible = true;
            this.suid = string.Empty;
            this.ipAddress = string.Empty;
            this.macAddress = string.Empty;
            this.question = string.Empty;
            this.answerQuestion = string.Empty;
            this.auditStatus = string.Empty;
            this.description = string.Empty;
            this.sortCode = string.Empty;
            this.createUserID = string.Empty;
            this.createDate = string.Empty;
            this.modifyUserID = string.Empty;
            this.modifyDate = string.Empty;
            this.GetFrom(DataRow);
        }

        public BaseUserEntity(DataTable DataTable)
        {
            this.id = string.Empty;
            this.userName = string.Empty;
            this.code = string.Empty;
            this.realname = string.Empty;
            this.role = "User";
            this.roleFullName = string.Empty;
            this.sex = string.Empty;
            this.birthday = string.Empty;
            this.mobile = string.Empty;
            this.oicq = string.Empty;
            this.email = string.Empty;
            this.homeAddress = string.Empty;
            this.userPassword = string.Empty;
            this.company = string.Empty;
            this.department = string.Empty;
            this.workgroup = string.Empty;
            this.duty = string.Empty;
            this.title = string.Empty;
            this.isStaff = true;
            this.firstVisit = string.Empty;
            this.previousVisit = string.Empty;
            this.lastVisit = string.Empty;
            this.loginCount = string.Empty;
            this.lang = string.Empty;
            this.theme = string.Empty;
            this.isVisible = true;
            this.suid = string.Empty;
            this.ipAddress = string.Empty;
            this.macAddress = string.Empty;
            this.question = string.Empty;
            this.answerQuestion = string.Empty;
            this.auditStatus = string.Empty;
            this.description = string.Empty;
            this.sortCode = string.Empty;
            this.createUserID = string.Empty;
            this.createDate = string.Empty;
            this.modifyUserID = string.Empty;
            this.modifyDate = string.Empty;
            this.GetFrom(DataTable);
        }

        public void ClearProperty()
        {
            this.ID = string.Empty;
            this.Code = string.Empty;
            this.Username = string.Empty;
            this.Role = string.Empty;
            this.RoleFullName = string.Empty;
            this.UserPassword = string.Empty;
            this.Company = string.Empty;
            this.Department = string.Empty;
            this.Duty = string.Empty;
            this.Title = string.Empty;
            this.FirstVisit = string.Empty;
            this.PreviousVisit = string.Empty;
            this.LastVisit = string.Empty;
            this.LoginCount = string.Empty;
            this.IsVisible = true;
            this.IsStaff = true;
            this.UserOnLine = 0;
            this.Lang = string.Empty;
            this.Theme = string.Empty;
            this.IPAddress = string.Empty;
            this.MACAddress = string.Empty;
            this.SUID = string.Empty;
            this.Question = string.Empty;
            this.AnswerQuestion = string.Empty;
        }

        public BaseUserInfo ConvertToUserInfo()
        {
            BaseUserInfo userInfo = new BaseUserInfo();
            return this.ConvertToUserInfo(userInfo);
        }

        public BaseUserInfo ConvertToUserInfo(BaseUserInfo userInfo)
        {
            userInfo.SUID = this.SUID;
            userInfo.ID = this.ID;
            userInfo.Code = this.Code;
            userInfo.Username = this.Username;
            userInfo.Realname = this.Realname;
            userInfo.CompanyFullName = this.Company;
            userInfo.DepartmentFullName = this.Department;
            userInfo.WorkgroupFullName = this.Workgroup;
            return userInfo;
        }

        public BaseUserEntity GetFrom(DataRow DataRow)
        {
            this.ID = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldID]);
            this.Username = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldUsername]);
            this.Code = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldCode]);
            this.Realname = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldRealname]);
            this.Role = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldRole]);
            this.UserPassword = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldUserPassword]);
            this.Company = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldCompany]);
            this.Department = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldDepartment]);
            this.Workgroup = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldWorkgroup]);
            this.Duty = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldDuty]);
            this.Title = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldDepartment]);
            this.IsStaff = BaseBusinessLogic.ConvertIntToBoolean(DataRow[BaseUserTable.FieldIsStaff]);
            this.FirstVisit = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldFirstVisit]);
            this.PreviousVisit = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldPreviousVisit]);
            this.LastVisit = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldLastVisit]);
            this.LoginCount = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldLoginCount]);
            this.UserOnLine = BaseBusinessLogic.ConvertToInt(DataRow[BaseUserTable.FieldUserOnLine]);
            this.Lang = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldLang]);
            this.Sex = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldSex]);
            this.Birthday = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldBirthday]);
            this.Mobile = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldMobile]);
            this.OICQ = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldOICQ]);
            this.Email = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldEmail]);
            this.HomeAddress = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldHomeAddress]);
            this.Theme = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldTheme]);
            this.IsVisible = BaseBusinessLogic.ConvertIntToBoolean(DataRow[BaseUserTable.FieldIsVisible]);
            this.SUID = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldSUID]);
            this.IPAddress = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldIPAddress]);
            this.MACAddress = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldMACAddress]);
            this.Question = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldQuestion]);
            this.AnswerQuestion = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldAnswerQuestion]);
            this.Enabled = BaseBusinessLogic.ConvertIntToBoolean(DataRow[BaseUserTable.FieldEnabled]);
            this.AuditStatus = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldAuditStatus]);
            this.DeleteMark = BaseBusinessLogic.ConvertIntToBoolean(DataRow[BaseUserTable.FieldDeleteMark]);
            this.SortCode = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldSortCode]);
            this.Description = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldDescription]);
            this.CreateUserID = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldCreateUserID]);
            this.CreateDate = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldCreateDate]);
            this.ModifyUserID = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldModifyUserID]);
            this.ModifyDate = BaseBusinessLogic.ConvertToString(DataRow[BaseUserTable.FieldModifyDate]);
            return this;
        }

        public BaseUserEntity GetFrom(DataTable DataTable)
        {
            foreach (DataRow row in DataTable.Rows)
            {
                this.GetFrom(row);
                break;
            }
            return this;
        }

        public string AnswerQuestion
        {
            get
            {
                return this.answerQuestion;
            }
            set
            {
                this.answerQuestion = value;
            }
        }

        public string AuditStatus
        {
            get
            {
                return this.auditStatus;
            }
            set
            {
                this.auditStatus = value;
            }
        }

        public string Birthday
        {
            get
            {
                return this.birthday;
            }
            set
            {
                this.birthday = value;
            }
        }

        public string Code
        {
            get
            {
                return this.code;
            }
            set
            {
                this.code = value;
            }
        }

        public string Company
        {
            get
            {
                return this.company;
            }
            set
            {
                this.company = value;
            }
        }

        public string CreateDate
        {
            get
            {
                return this.createDate;
            }
            set
            {
                this.createDate = value;
            }
        }

        public string CreateUserID
        {
            get
            {
                return this.createUserID;
            }
            set
            {
                this.createUserID = value;
            }
        }

        public bool DeleteMark
        {
            get
            {
                return this.deleteMark;
            }
            set
            {
                this.deleteMark = value;
            }
        }

        public string Department
        {
            get
            {
                return this.department;
            }
            set
            {
                this.department = value;
            }
        }

        public string Description
        {
            get
            {
                return this.description;
            }
            set
            {
                this.description = value;
            }
        }

        public string Duty
        {
            get
            {
                return this.duty;
            }
            set
            {
                this.duty = value;
            }
        }

        public string Email
        {
            get
            {
                return this.email;
            }
            set
            {
                this.email = value;
            }
        }

        public bool Enabled
        {
            get
            {
                return this.enabled;
            }
            set
            {
                this.enabled = value;
            }
        }

        public string FirstVisit
        {
            get
            {
                return this.firstVisit;
            }
            set
            {
                this.firstVisit = value;
            }
        }

        public string HomeAddress
        {
            get
            {
                return this.homeAddress;
            }
            set
            {
                this.homeAddress = value;
            }
        }

        public string ID
        {
            get
            {
                return this.id;
            }
            set
            {
                this.id = value;
            }
        }

        public string IPAddress
        {
            get
            {
                return this.ipAddress;
            }
            set
            {
                this.ipAddress = value;
            }
        }

        public bool IsStaff
        {
            get
            {
                return this.isStaff;
            }
            set
            {
                this.isStaff = value;
            }
        }

        public bool IsVisible
        {
            get
            {
                return this.isVisible;
            }
            set
            {
                this.isVisible = value;
            }
        }

        public string Lang
        {
            get
            {
                return this.lang;
            }
            set
            {
                this.lang = value;
            }
        }

        public string LastVisit
        {
            get
            {
                return this.lastVisit;
            }
            set
            {
                this.lastVisit = value;
            }
        }

        public string LoginCount
        {
            get
            {
                return this.loginCount;
            }
            set
            {
                this.loginCount = value;
            }
        }

        public string MACAddress
        {
            get
            {
                return this.macAddress;
            }
            set
            {
                this.macAddress = value;
            }
        }

        public string Mobile
        {
            get
            {
                return this.mobile;
            }
            set
            {
                this.mobile = value;
            }
        }

        public string ModifyDate
        {
            get
            {
                return this.modifyDate;
            }
            set
            {
                this.modifyDate = value;
            }
        }

        public string ModifyUserID
        {
            get
            {
                return this.modifyUserID;
            }
            set
            {
                this.modifyUserID = value;
            }
        }

        public string OICQ
        {
            get
            {
                return this.oicq;
            }
            set
            {
                this.oicq = value;
            }
        }

        public string PreviousVisit
        {
            get
            {
                return this.previousVisit;
            }
            set
            {
                this.previousVisit = value;
            }
        }

        public string Question
        {
            get
            {
                return this.question;
            }
            set
            {
                this.question = value;
            }
        }

        public string Realname
        {
            get
            {
                return this.realname;
            }
            set
            {
                this.realname = value;
            }
        }

        public string Role
        {
            get
            {
                return this.role;
            }
            set
            {
                this.role = value;
            }
        }

        public string RoleFullName
        {
            get
            {
                return this.roleFullName;
            }
            set
            {
                this.roleFullName = value;
            }
        }

        public string Sex
        {
            get
            {
                return this.sex;
            }
            set
            {
                this.sex = value;
            }
        }

        public string SortCode
        {
            get
            {
                return this.sortCode;
            }
            set
            {
                this.sortCode = value;
            }
        }

        public string SUID
        {
            get
            {
                return this.suid;
            }
            set
            {
                this.suid = value;
            }
        }

        public string Theme
        {
            get
            {
                return this.theme;
            }
            set
            {
                this.theme = value;
            }
        }

        public string Title
        {
            get
            {
                return this.title;
            }
            set
            {
                this.title = value;
            }
        }

        public string Username
        {
            get
            {
                return this.userName;
            }
            set
            {
                this.userName = value;
            }
        }

        public int UserOnLine
        {
            get
            {
                return this.userOnLine;
            }
            set
            {
                this.userOnLine = value;
            }
        }

        public string UserPassword
        {
            get
            {
                return this.userPassword;
            }
            set
            {
                this.userPassword = value;
            }
        }

        public string Workgroup
        {
            get
            {
                return this.workgroup;
            }
            set
            {
                this.workgroup = value;
            }
        }
    }
}